<?php



//引用所需文件  
require_once '../vendor/autoload.php';  
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Exchange\AMQPExchangeType;
use PhpAmqpLib\Message\AMQPMessage;

//建立一个连接通道，声明一个可以发送消息的队列hello  
$connection = new AMQPStreamConnection('106.13.63.203',5672, '1703phpa', '123456','1703phpa');  
$channel = $connection->channel();  
$channel->queue_declare('myque', false, false, false, false);  

var_dump($argv);

$inputMsg = $argv[1];

if(!$inputMsg){

    $inputMsg = "hello world";
}

  
//定义一个消息，消息内容为Hello World!  
$msg = new AMQPMessage($inputMsg.time());  
$channel->basic_publish($msg, '', 'myque');  
  
//发送完成后打印消息告诉发布消息的人：发送成功  
echo " [x] Sent $inputMsg \n";  
//关闭连接  
$channel->close();  
$connection->close();

//fdshfdsjfdsjhfhdsgf






?>
